package OODay03;

import java.util.Arrays;

/**
 * 引用类型数组的演示
 */

public class RefArrayDemo {
    public static void main(String[] args) {

        Dog[] dogs = new Dog[3];
        dogs[0] = new Dog("大黄",1,"绿色");
        dogs[1] = new Dog("大绿",3,"黄色");
        dogs[2] = new Dog("大紫",2,"黑色");

        for (int i = 0; i < dogs.length; i++) {
            //System.out.println(dogs[i].name);
            dogs[i].eat();
        }

        Fish[] fish = new Fish[2];
        fish[0] = new Fish("大青",123,"小青色");
        fish[1] = new Fish("大啊",11245,"大绿色");

        for (int i = 0; i < fish.length; i++) {
            //System.out.println(fish[i].name);
            fish[i].eat();
        }

        Chick[] chicks = new Chick[3];
        chicks[0] = new Chick("大黄421",1231,"汗色");
        chicks[1] = new Chick("大黄2",163,"大紫色");
        chicks[2] = new Chick("大黄4",17865,"大红色");

        for (int i = 0; i < chicks.length; i++) {
           // System.out.println(chicks[i].name);
            chicks[i].eat();
        }
    }
}
